<?php
class LotteryService{
	var $dbutil;

	function __construct($dbutil){
		$this->dbutil = $dbutil;
	}

	function user_email($emailid){
		$sql = "select id, emailid, email, is_lottery, is_send_mail from user_emails where emailid = '".$emailid."'";
		return $this->dbutil->get_results($sql);
	}

	function email($mail){
		$sql= "select id, email from emails where email='".$mail."'";
		return $this->dbutil->get_results($sql);
	}

	function lotteryRecords($limit){
		$sql = "select * from user_lottery_record order by create_time desc limit ". $limit;
		return $this->dbutil->get_results($sql);
	}
}
?>